package com.atguigu.lease.web.admin.custom.converter;

import com.atguigu.lease.model.enums.ReleaseStatus;
import org.springframework.core.convert.converter.Converter;


public class StringToReleaseStatusConverter implements Converter<String, ReleaseStatus> {
    @Override
    public ReleaseStatus convert(String souce) {
        for (ReleaseStatus releaseStatus : ReleaseStatus.values()) {
            if(souce.equals(releaseStatus.getCode()+"")){
                return releaseStatus;
            }
        }
        throw new RuntimeException("类型必须是0或者1");

    }


}
